package com.yunlankeji.stemcells.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.yunlankeji.ganxibaozhijia.R;
import com.yunlankeji.stemcells.model.request.project_of_focus;

import java.util.List;

public class Project_of_focusAdapter  extends RecyclerView.Adapter<Project_of_focusAdapter.MyViewHolder> {

    private List<project_of_focus> project_of_focusList;

    public Project_of_focusAdapter(List<project_of_focus> project_of_focusList) {
        this.project_of_focusList = project_of_focusList;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View itemview= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_mine_projects_of_focus,parent,false);

        MyViewHolder myViewHolder =new MyViewHolder(itemview);
        return myViewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        project_of_focus project_of_focus = project_of_focusList.get(position);
        holder.project.setText(project_of_focus.getProject());
        holder.organization.setText(project_of_focus.getProject());
        holder.follow.setText(project_of_focus.getFollow());
        holder.follow_Type.setText(project_of_focus.getFollow_Type());
        holder.picture.setImageResource(project_of_focus.getPicture());

    }

    @Override
    public int getItemCount() {
        return project_of_focusList.size();
    }

    class  MyViewHolder extends RecyclerView.ViewHolder {
        TextView project;
        TextView organization;
        TextView follow;
        TextView follow_Type;
        RecyclerView label_RecyclerView;
        ImageView picture;

        public MyViewHolder(View itemview) {
            super(itemview);
            this.project = itemview.findViewById(R.id.mine_project_of_focus_project_tv);
            this.organization = itemview.findViewById(R.id.mine_project_of_focus_organization_tv);
            this.follow = itemview.findViewById(R.id.mine_project_of_focus_follow_tv);
            this.follow_Type = itemview.findViewById(R.id.mine_project_of_focus_follow_Type_tv);
            this.label_RecyclerView = itemview.findViewById(R.id.mine_project_of_focus_label_RecyclerView);
            this.picture = itemview.findViewById(R.id.mine_project_of_focus_picture_iv);
        }
    }
}
